﻿<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no, maximum-scale=1.0" />
    <title>首页</title>
    <link rel="stylesheet" type="text/css" href="css/common.css" />
    <link rel="stylesheet" type="text/css" href="css/index.css" />
    <link rel="stylesheet" type="text/css" href="css/pullToRefresh.css" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <script type="text/javascript" src="lib/PIE_IE678.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.7/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/file.css" />
    <link href="static/h-ui.admin/css/pageloader.css" rel="stylesheet" />
    <!--[if IE 6]>
    <script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->

    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
    <script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
    <script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="static/h-ui/js/H-ui.js"></script>
    <script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script>
    <script src="static/usi/core.js"></script>
    <script src="static/usi/tools.js"></script>
</head>

<body>
    <div class="container">
        <main>
            <div class="other">
                <nav class="video-show">
                    <div class="Promotional" id="m1">
                      
                    </div>
                </nav>
                <nav class="info">
                    <label>信号源：</label>
                    <div class="info-right">
                        <ul class="info-list" id="videoli">
                        </ul>
                    </div>
                </nav>
                <nav class="safe-view">
                    <div class="">
                        <ul class="viewboxone">
                            <li>
                                <span><em class="cor_g" id="YLevel"></em></span>
                                <p>上年度综合等级</p>
                            </li>
                            <li>
                                <span id="CLevel"></span>
                                <p>本次检查动态等级</p>
                            </li>
                        </ul>
                        <ul class="viewboxtwo">
                            <li>
                                <div class="grade"><img src="image/green.png" /></div> <label class="cor_g">A 优秀</label>
                            </li>
                            <li>
                                <div class="grade"><img src="image/yellow.png" /></div><label class="cor_y">B 良好</label>
                            </li>
                            <li>
                                <div class="grade"><img src="image/red.png" /></div><label class="cor_r">C 一般</label>
                            </li>
                        </ul>
                        <p class="safe-title viewnum"><img src="image/item.png" width="20" height="20"><span id="CheckNum"></span></p>
                    </div>
                </nav>
            </div>
            <div class="news">
                <div class="activety-warp" id="wrapper" style="width: 100%;height:400px;">
                    <ul class="activity-main" style="display: block !important;">
                    </ul>
                </div>

            </div>
            <footer>
                <span>投诉电话：12345 12331 12315</span>
                <a href="tel:12331">立即拨打</a>
            </footer>
        </main>
    </div>
</body>

</html>
<style>
    .viewboxtwo {
        margin: 10px 0px 10px;
        overflow: hidden;
    }

        .viewboxtwo li {
            text-align: center;
            font-size: 14px;
            font-weight: bold;
        }

            .viewboxtwo li img {
                width: 32px;
                height: 32px;
                vertical-align: sub;
            }

    .cor_g {
        color: green;
    }

    .cor_y {
        color: goldenrod;
    }

    .cor_r {
        color: brown;
    }
</style>
<script src="js/iscroll.js"></script>
<script src="js/pullToRefresh.js"></script>
<script src="js/Ckplayer/ckplayer.js"></script>
<script>
    $(function () {
        $(".info-list li").click(function () {
            $(this).addClass('on').siblings().removeClass('on');
        });

    });
    refresher.init({
        id: "wrapper",
        pullUpAction: Load,
        pullDownAction: Refresh,
    });

    function Refresh() {
        myScroll.refresh();
    }
    function Load() {
        if (isData) {
            vcurrentPage = vcurrentPage + 1;
            LoadNewsData();
            myScroll.refresh();
        } else {
            myScroll.refresh();
        }
    }
    var enterpriseUnid;
    var isData = true;
    function LoadNewsData() {
        jQuery.usi.core.get(ip + api + "/GetConsumerTipsData", { whereValue: "", currentPage: vcurrentPage, pageSize: 3 }, true, function (data) {
            debugger;
            if (!jQuery.usi.core.isNullOrEmpty(data.data)) {
                $.each(data.data, function (index, item) {
                    var li = $('<li class="box-shadow"></li>');
                    var div = $('<div class="aitivity-box"></div>');
                    var a = $('<a href="#"></a>');
                    var p = $('<p class="omitted2">' + item.title + '</p>');
                    a.bind("click", function () {
                        window.location.href = "detail.html?EnterpriseUnid=" + enterpriseUnid + "&Unid=" + item.unid;
                    });
                    a.append(p);
                    div.append(a);
                    li.append(div);
                    $('.activity-main').append(li);
                });
            } else {
                isData = false;
            }
        });
    }
    var vcurrentPage = 1;
    window.onload = function () {
        enterpriseUnid = jQuery.usi.core.getURLParam("Unid");
        if (jQuery.usi.core.isNullOrEmpty(enterpriseUnid)) {
            enterpriseUnid = "d38feb2aa4a6474495e93365a2d9b8a8";
        }
        //获取企业诚信等级相关
        jQuery.usi.core.get(ip + api + "/GetSingleEnterprise", { unid: enterpriseUnid }, false, function (data) {
            if (!jQuery.usi.core.isNullOrEmpty(data.data)) {
                if (!jQuery.usi.core.isNullOrEmpty(data.data.config_CreditLevelUnid)) {
                    $("#YLevel").html(data.data.config_CreditLevelUnid);
                } else {
                    $("#YLevel").html("未");
                }
                if (!jQuery.usi.core.isNullOrEmpty(data.data.dynamicCreditLevelUnid)) {
                    if (data.data.dynamicCreditLevelUnid == "优秀") {
                        img = $('<img src="image/green.png" />');
                        $("#CLevel").append(img);
                    }else if (data.data.dynamicCreditLevelUnid == "良好") {
                        img = $('<img src="image/yellow.png" />');
                        $("#CLevel").append(img);
                    }else if (data.data.dynamicCreditLevelUnid == "一般") {
                        img = $('<img src="image/red.png" />');
                        $("#CLevel").append(img);
                    } else {
                        $("#CLevel").html(data.data.dynamicCreditLevelUnid);
                    }
                } else {
                    $("#CLevel").html("未评级");
                }
            }
        });
        //获取企业检查次数
        jQuery.usi.core.get(ip + api + "/GetSingleEnterpriseCheckNumber", { unid: enterpriseUnid }, false, function (data) {
            debugger;
            if (!jQuery.usi.core.isNullOrEmpty(data.data)&&data.data!=0) {
                $("#CheckNum").html("已检查次数（" + data.data + "）");
            } else {
                $("#CheckNum").html("未开始检查");
            }

        });
        //获取消费提示
        LoadNewsData();
        //获取设备
        jQuery.usi.core.get(ip + api + "/GetCameraData", { enterpriseUnid: enterpriseUnid }, false, function (data) {
            var ul = $("#videoli");
            var aa;
            if (!jQuery.usi.core.isNullOrEmpty(data.data)) {
                $.each(data.data, function (index, item) {
                    var li = $("<li  onclick=\"AddCamera('" + item.pathRTMP + "'," + (index + 1) + ")\">" + item.name+"</li>");
                    ul.append(li);
                    if (index == 0) {
                        aa = li;
                    }
                });
            } else {
                var li = $("<li onclick=\"AddCamera('http://www.w3school.com.cn/i/movie.ogg'," + 1 + ")\" >默认视频</li>");
                aa = li;
                ul.append(li);
            }
            $('.info-right>ul>li').click(function () {
                $(this).addClass("on").siblings().removeClass("on");   //给li加tab的样式
            })
            aa.trigger("click");
        });
    }
    function AddCamera(url, num) {
        //var flashvars = { f: url, c: 0, p: 0 };
        //var params = { bgcolor: '#000000', allowFullScreen: true, allowScriptAccess: 'always', wmode: 'transparent' };
        //var video = [url + '->video/mp4'];
        //var signnum = "m1";
        //var width = "740";
        //var height = "520";
        //CKobject.embedSWF('/js/Ckplayer/ckplayer.swf', signnum, 'ckplayer_' + signnum, width, height, flashvars, params);
        var flashvars = { f: '/js/ckplayer/m3u8.swf', a: url, c: 0, s: 4, p: 1, lv: 1, v: 100, b: 1 };
        var params = { bgcolor: '#000000', allowFullScreen: true, allowScriptAccess: 'always', wmode: 'transparent' };
        var video = [url + '->video/mp4'];
        CKobject.embed('/js/ckplayer/ckplayer.swf', 'm1', 'ckplayer_m1', '100%', '100%', false, flashvars, video, params);
    }
</script>